//package com.hansming.bss.modules.sfc.web.front;
//
//import java.io.IOException;
//import java.io.PrintWriter;
//import java.util.ArrayList;
//import java.util.List;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
//import org.activiti.engine.impl.util.json.JSONArray;
//import org.activiti.engine.impl.util.json.JSONObject;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Controller;
//import org.springframework.ui.Model;
//import org.springframework.web.bind.annotation.RequestMapping;
//
//import com.hansming.bss.common.web.BaseController;
//import com.hansming.bss.modules.sfc.entity.CarDatePrice;
//import com.hansming.bss.modules.sfc.entity.City;
//import com.hansming.bss.modules.sfc.entity.Line;
//import com.hansming.bss.modules.sfc.entity.LineBranch;
//import com.hansming.bss.modules.sfc.entity.LineCharact;
//import com.hansming.bss.modules.sfc.entity.LineCityType;
//import com.hansming.bss.modules.sfc.entity.LineDatePrice;
//import com.hansming.bss.modules.sfc.entity.LineDays;
//import com.hansming.bss.modules.sfc.entity.LineExtr;
//import com.hansming.bss.modules.sfc.service.CityService;
//import com.hansming.bss.modules.sfc.service.LineBranchService;
//import com.hansming.bss.modules.sfc.service.LineCharactService;
//import com.hansming.bss.modules.sfc.service.LineDatePriceService;
//import com.hansming.bss.modules.sfc.service.LineDaysService;
//import com.hansming.bss.modules.sfc.service.LineExtrService;
//import com.hansming.bss.modules.sfc.service.LineService;
//import com.hansming.bss.modules.sfc.util.LineTypeCities;
//import com.hansming.bss.modules.sfc.util.ListLineinfo;
//import com.hansming.bss.modules.sfc.util.PageBean;
//import com.hansming.bss.modules.sfc.service.LineCityTypeService;
//
///**
// * 前端页面line相关 Controller
// * @author Hansming
// * @version 2017-10-11
// */
//@Controller
//@RequestMapping(value = "${frontAdminPath}/line")
//public class FrontLineController extends BaseController {
//	
//	@Autowired
//	private LineService lineService;
//	
//	@Autowired 
//	private LineDatePriceService lineDatePriceService;
//	
//	@Autowired
//	private CityService cityService;
//	
//	@Autowired
//	private LineCityTypeService lineCityTypeService; 
//	
//	@Autowired
//	private LineCharactService linecharactService;
//	
//	@Autowired
//	private LineExtrService lineExtrService;
//	
//	@Autowired
//	private LineBranchService lineBranchService;
//	
//	@Autowired
//	private LineDaysService linedaysService;
//	
//	
//	
//	//前端线路首页跳转信息     *注：遍历线路分类。线路分类分别包含城市和线路（在线路主页内，点击城市跳转线路列表页 不是展示该城市包含的线路集合）
//	@RequestMapping(value = "")
//	public String getLineIndex(){
////		从数据库查出线路的分类和类别中包含的城市，封装城市名和城市集合在封装工具类LineTypeCities中；
//		List<LineCityType> lineCityTypes = lineCityTypeService.findList(new LineCityType());
//		List<LineTypeCities> typeCities = new ArrayList<LineTypeCities>();
//		for(LineCityType lct:lineCityTypes){
//			LineTypeCities lcities = new LineTypeCities();
//			List<City> cities = cityService.selectByType(lct.getId());
////			List<Line> lines = lineService.findtypeLines(lct.getId());
//			lcities.setType(lct.getTypename()); 
//			lcities.setCities(cities);
////			lcities.setLines(lines);
//			typeCities.add(lcities);			
//		}
//		
//			
//		return "";
//	}
//	
//	
//	//线路搜索接口跳转线路列表页面
//	@RequestMapping(value = "/search")
//	public String search(String city,int days,int startmonth,int endmonth,int month,String startprice,String endprice,PageBean page,int sortid,int orderid,Model model){
//		if(page == null){
//			page = new PageBean();
//		}
//		//设置每一页的显示的数量
//        page.setPageSize(7); 
//		List<Line> lines = lineService.search(city, days, startmonth, endmonth, month, startprice, endprice,sortid,orderid, page);
//		
//		//把只用于展示的列表的信息用封装类传递到页面
//		List<ListLineinfo> lineinfo = new ArrayList<ListLineinfo>();
//		for(Line l:lines){
//			ListLineinfo lf = new ListLineinfo();
//			lf.setId(l.getId());
//			lf.setShow_url(l.getShowurl());
//			lf.setTitle(l.getTitle());
//			lf.setDays(l.getDays());
//			lf.setPrice(l.getPrice());
//			lf.setStarttime(l.getStarttime());
//			List<LineCharact> lcs = linecharactService.selectCharacteristicByLineid(l.getId());
//			List<String> characts = new ArrayList<String>();
//			for(LineCharact lc:lcs){
//				characts.add(lc.getCharacteristic());
//			}
//			lf.setCharactores(characts);
//		}
//		model.addAttribute("line",lineinfo);
//		model.addAttribute("city", city);
//		model.addAttribute("days", days);
//		model.addAttribute("startmonth", startmonth);
//		model.addAttribute("endmonth", endmonth);
//		model.addAttribute("month", month);
//		model.addAttribute("startprice", startprice);
//		model.addAttribute("endprice", endprice);
//		model.addAttribute("page", page);
//		model.addAttribute("startprice", startprice);
//		model.addAttribute("endprice", endprice);
//		model.addAttribute("sortid",sortid);
//		model.addAttribute("orderid",orderid);
//		
//		return "";
//	}
//	
//	//根据id跳转详情页
//	@RequestMapping(value = "/getlineinfo")
//	public  String  getLineinfoByid(String lineid,Model model){
//		Line line = lineService.get(lineid);
//		LineExtr lineExtr = lineExtrService.getLineExtrByLineId(lineid);
//		List<LineCharact> lineCharacts = linecharactService.selectCharacteristicByLineid(lineid);
//		List<LineBranch> lineBranches = lineBranchService. selectByLineid(lineid);
//		List<LineDays> lineDays = linedaysService.selectBylineid(lineid);
//		
//		return "";
//	}
//	
//	
//	//得到价格日历json    传递的id是线路分支line_branch的id
//	@RequestMapping(value="/getprice")
//	public void getCarprice(String id,HttpServletRequest request, HttpServletResponse response) throws IOException{
//		response.setCharacterEncoding("UTF-8");
//        response.setHeader("Cache-Control", "no-cache");
//        PrintWriter out = response.getWriter();
//        JSONObject jsonObject = new JSONObject();
//		String resCode = "1";								//返回前台的消息状态
//		String message = "";								//返回前台的消息
//		JSONArray datas = new JSONArray();		//返回到前台的具体的价格日期信息json
//		List<LineDatePrice> prices = lineDatePriceService.selectByLineBranchId(id);
//		for(LineDatePrice p:prices){
//			JSONObject data1 =  new JSONObject();
//			data1.put("date", p.getDatetime());
//			data1.put("adultprice",p.getAdultprice());
//			data1.put("childprice",p.getChildprice());
//			data1.put("maxperson",p.getMaxperson());
//			datas.put(data1);
//			}
//		jsonObject.put("resCode", resCode);
//		jsonObject.put("message", message);
//		jsonObject.put("data", datas);
//		out.print(jsonObject.toString());
//		out.flush();
//		out.close();
//	}
//	
//	
//	//获得根据用户联系人json
//	@RequestMapping(value = "/getConnacts")
//	public void getConnacts(String cid,HttpServletRequest request, HttpServletResponse response) throws IOException{
//		response.setCharacterEncoding("UTF-8");
//        response.setHeader("Cache-Control", "no-cache");
//        PrintWriter out = response.getWriter();
//        JSONObject jsonObject = new JSONObject();
//    	String resCode = "1";								//返回前台的消息状态
//		String message = "";								//返回前台的消息
//		JSONArray datas = new JSONArray();		//返回到前台的具体的价格日期信息json
//		//现未完成
//        
//        
//        
//		jsonObject.put("resCode", resCode);
//		jsonObject.put("message", message);
//		jsonObject.put("data", datas);
//		out.print(jsonObject.toString());
//		out.flush();
//		out.close();
//	}
//	
//}
